#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=505,mod=998244353;
int n,m,a[N],f[1<<18][20];
char s[N];
int main(){
	freopen("employ.in","r",stdin);
	freopen("employ.out","w",stdout);
	scanf("%d %d\n%s",&n,&m,s+1);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	f[0][0]=1;
	for(int i=0;i<1<<n;i++){
		int x=__builtin_popcount(i);
		for(int j=0;j<=x;j++){
			for(int k=1;k<=n;k++){
				if(i>>k-1&1)continue;
				int v=x-j>=a[k]&&s[x+1]=='1';
				f[i|1<<k-1][j+v]=(f[i|1<<k-1][j+v]+f[i][j])%mod;
			}
		}
	}
	int ans=0;
	for(int i=m;i<=n;i++){
		ans=(ans+f[(1<<n)-1][i])%mod;
	}
	printf("%d",ans);
	return 0;
}